<template>
  <view class="archives-view">
    <view class="box box-o" v-if="type==1">
      <view  class="list personal">
        <view class="list-left">
          <view class="name">{{userInfo.name}}</view>
          <view class="user-info">{{userInfo.gender}}-{{userInfo.age}}岁</view>
        </view>
        <view class="list-right" @click="edit(userInfo.id)">
          <view class="edit-pic" >
            <image class="pic" src="@/static/edit.png"></image>
          </view>
        </view>
      </view>
    </view>
    <view class="box">
		<view class="list">
		  <view class="list-left">积分</view>
		  <view class="list-right">{{userInfo.score}}</view>
		</view>
      <view class="list">
        <view class="list-left">学部</view>
        <view class="list-right">{{userInfo.department}}</view>
      </view>
           <view class="list">
        <view class="list-left">学科</view>
        <view class="list-right">{{userInfo.subject}}</view>
      </view>
           <view class="list">
        <view class="list-left">民族</view>
        <view class="list-right">{{userInfo.nation}}</view>
      </view>
           <view class="list">
        <view class="list-left">身份证号</view>
        <view class="list-right">{{userInfo.id_number}}</view>
      </view>
           <view class="list">
        <view class="list-left">出生年月</view>
        <view class="list-right">{{userInfo.birth}}</view>
      </view>
           <view class="list">
        <view class="list-left">联系电话</view>
        <view class="list-right">{{userInfo.mobile}}</view>
      </view>
           <view class="list">
        <view class="list-left">籍贯</view>
        <view class="list-right">{{userInfo.native_place}}</view>
      </view>
           <view class="list">
        <view class="list-left">户贯</view>
        <view class="list-right">{{userInfo.registered_residence}}</view>
      </view>
           <view class="list">
        <view class="list-left">家庭住址</view>
        <view class="list-right">{{userInfo.home_address}}</view>
      </view>
          <view class="list">
        <view class="list-left">家庭状况</view>
        <view class="list-right">{{userInfo.marital_status}}</view>
      </view>
    </view>
    <view class="box">
      <view class="list">
        <view class="list-left">参加工作时间</view>
        <view class="list-right">
          {{userInfo.working_time}}
          </view>
      </view>
           <view class="list">
        <view class="list-left">工龄</view>
        <view class="list-right">{{userInfo.working_years}}</view>
      </view>
           <view class="list">
        <view class="list-left">政治面貌</view>
        <view class="list-right">{{userInfo.political_face}}</view>
      </view>
           <view class="list">
        <view class="list-left">学历</view>
        <view class="list-right">{{userInfo.education}}</view>
      </view>
           <view class="list">
        <view class="list-left">学位</view>
        <view class="list-right">{{userInfo.academic_degree}}</view>
      </view>
           <view class="list">
        <view class="list-left">专业</view>
        <view class="list-right">{{userInfo.major}}</view>
      </view>
           <view class="list">
        <view class="list-left">教师资格</view>
        <view class="list-right">{{userInfo.qualification}}</view>
      </view>
           <view class="list">
        <view class="list-left">职称</view>
        <view class="list-right">{{userInfo.title}}</view>
      </view>
           <view class="list">
        <view class="list-left">任教科目</view>
        <view class="list-right">{{userInfo.teaching_subject}}</view>
      </view>
          <view class="list">
        <view class="list-left">人员分类</view>
        <view class="list-right">{{userInfo.personnel_category}}</view>
      </view>
          <view class="list">
        <view class="list-left">第一学历</view>
        <view class="list-right">{{userInfo.first_degree}}</view>
      </view>
           <view class="list">
        <view class="list-left">第一学历毕业院校及专业</view>
        <view class="list-right">{{userInfo.first_degree_school}}</view>
      </view>
           <view class="list">
        <view class="list-left">最高学历</view>
        <view class="list-right">{{userInfo.highest_education}}</view>
      </view>
           <view class="list">
        <view class="list-left">最高学历毕业院校及专业</view>
        <view class="list-right">{{userInfo.highest_education_school}}{{userInfo.highest_education_major}}</view>
      </view>
    </view>
    <view class="box">
      <view class="list">
        <view class="list-left">深圳任教起止时间</view>
        <view class="list-right">{{userInfo.working_time_sz}}</view>
      </view>
           <view class="list">
        <view class="list-left">三名工程评选情况</view>
        <view class="list-right">{{userInfo.three_projects}}</view>
      </view>
           <view class="list">
        <view class="list-left">入选未来教育家情况</view>
        <view class="list-right">{{userInfo.future_educators}}</view>
      </view>
           <view class="list">
        <view class="list-left">入员来源</view>
        <view class="list-right">{{userInfo.personnel_source}}</view>
      </view>
           <view class="list">
        <view class="list-left">进入本单位时间</view>
        <!-- <view class="list-right">{{userInfo.entry_time?moment(parseFloat(userInfo.entry_time)).format('YYYY-MM-DD'):""}}</view> -->
        <view class="list-right">{{userInfo.entry_time}}</view>
      </view>
           <view class="list">
        <view class="list-left">离开本单位时间</view>
        <view class="list-right">{{userInfo.leave_time}}</view>
      </view>
           <view class="list">
        <view class="list-left">紧急联系人</view>
        <view class="list-right">{{userInfo.emergency_contact}}</view>
      </view>
           <view class="list">
        <view class="list-left">紧急联系人关系</view>
        <view class="list-right">{{userInfo.relationship}}</view>
      </view>
           <view class="list">
        <view class="list-left">紧急联系电话</view>
        <view class="list-right">{{userInfo.emergency_contact_mobile}}</view>
      </view>
    </view>
  </view>
</template>
<script>
import moment from "moment"
	export default {
    props:{
      type:{
        default:1,
      },
        userInfo:{
      },
    },
	data() {
			return {
				moment,
			}
		},
		mounted(){
			setTimeout(()=>{
        if(this.userInfo.entry_time){
          if(this.userInfo.entry_time!="无"){
          this.userInfo.entry_time = this.timestampToTime(this.userInfo.entry_time)
          }
        }else{
          this.userInfo.entry_time = "无"
        }
        if(this.userInfo.leave_time){
          if(this.userInfo.leave_time!="无" ){
          this.userInfo.leave_time = this.timestampToTime(this.userInfo.leave_time)
          }
        }else{
          this.userInfo.leave_time = "无"
        }
        if(this.userInfo.working_time){
          if(this.userInfo.working_time!="无"){
          this.userInfo.working_time = this.timestampToTime(this.userInfo.working_time)
          }
        }else{
          this.userInfo.working_time = "无"
        }
			},500)
			
		},
		methods: {
      edit(id){
		uni.navigateTo({
		  url:"/pages/archives/index/edit?id="+id,
			})
		},
		timestampToTime(timestamp) {
			var date = new Date(timestamp * 1000);//时间戳为10位需*1000，时间戳为13位的话不需乘1000
			var Y = date.getFullYear() + '-';
			var M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';
			var D = date.getDate() + ' ';
			var h = date.getHours() + ':';
			var m = date.getMinutes() + ':';
			var s = date.getSeconds();
			return Y+M+D;
			}
		}
	}
</script>

<style lang="less">
.archives-view{
  .box{
    width: 100%;
    box-sizing: border-box;
    margin-top: 30rpx;
    background: #fff;
    padding: 20rpx 30rpx;
    box-sizing: border-box;
    .list{
      width: 100%;
      box-sizing: border-box;
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-top: 20rpx;
        .list-left{ 
          display: flex;
          align-items: flex-end;
          font-size: 25rpx;
          color: #939393;
          .name{
            font-size: 34rpx;
            font-weight: bold;
            color: #353437;
            margin-right: 20rpx;
          }
          .user-info{
            font-size: 26rpx;
            color:#939393;
          }
        }
      .list-right{
          font-size: 25rpx;
          color: #939393;
        .edit-pic{
          width: 30rpx;
          height: 30rpx;
          .pic{
            width: 100%;
            height: 100%;
          }
        }
      }
    }
  }
  .box-o{
    margin-bottom: -60rpx;
  }
}
</style>